Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency management #118

Merged
merged 6 commits into from
Sep 28, 2024
Merged

Dependency management #118

merged 6 commits into from
Sep 28, 2024

Conversation

talmo
Copy link
Contributor

@talmo talmo commented Sep 28, 2024

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores

    • Removed the "av" dependency from the project configuration, streamlining the dependency list.
    • Updated the "ndx-pose" dependency to specify a version constraint of <0.2.0, ensuring compatibility.
    • Updated the package version from 0.1.8 to 0.1.9, indicating a new release.
  • Tests

    • Introduced a new test case for the test_mediavideo function, enhancing coverage for the FFMPEG backend.

Copy link
Contributor

coderabbitai bot commented Sep 28, 2024

Walkthrough

The changes involve modifications to the pyproject.toml and environment.yml files, specifically in the dependencies sections. The dependency "av" has been removed from both files, and the dependency "ndx-pose" has been updated to specify a version constraint of "ndx-pose<0.2.0". Additionally, the tests/io/test_video_backends.py file has been updated to include a new test case for the test_mediavideo function, incorporating a conditional check for the availability of the av module. The version number in sleap_io/version.py has also been incremented from 0.1.8 to 0.1.9.

Changes

File Change Summary
pyproject.toml, environment.yml Removed dependency "av" and updated "ndx-pose" to "ndx-pose<0.2.0" in the dependencies section.
tests/io/test_video_backends.py Introduced a new test case for test_mediavideo with a conditional check for the av module.
sleap_io/version.py Updated version number from 0.1.8 to 0.1.9.

Sequence Diagram(s)

(No sequence diagrams generated as the changes do not involve new features or complex control flow modifications.)

Possibly related PRs

  • Add support for embedding images in .pkg.slp #91: The main PR removes the "av" dependency, which is directly related to the changes in the tests/io/test_video_backends.py file that modifies the test logic based on the availability of the av module.
  • Support NumPy > 2.0 and Python 3.12 #115: The main PR updates the "ndx-pose" dependency in both pyproject.toml and environment.yml, which is relevant to the changes in sleap_io/io/slp.py that involve modifications to the data types used for encoding JSON strings, potentially affecting how dependencies are managed in the environment setup.

Poem

In the garden where dependencies play,
A little rabbit hopped, brightening the day.
"Goodbye, dear av, it's time to part,
With ndx-pose in tow, we'll make a fresh start!"
🐇✨
"In our code, we find joy anew,
Hopping along, with changes so true!"


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b482d4e and 5af40ba.

📒 Files selected for processing (1)
  • sleap_io/version.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • sleap_io/version.py

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
pyproject.toml (1)

Line range hint 1-31: Summary of changes and potential impact

The removal of the "av" dependency from pyproject.toml is the only change in this file, which aligns with the PR objective. This focused change is good practice. However, it's crucial to ensure that this modification doesn't negatively impact the project's functionality.

Consider the following:

  1. Test the project thoroughly to ensure that all video processing features still work as expected without "av".
  2. Update the project's documentation to reflect this change in dependencies.
  3. If "av" was used for specific features that imageio-ffmpeg doesn't cover, ensure that alternative solutions are implemented and documented.

To maintain the project's flexibility, you might want to consider making imageio-ffmpeg an optional dependency. This would allow users who don't need video processing capabilities to install a lighter version of your package. You can achieve this by moving imageio-ffmpeg to an optional dependency group in pyproject.toml, like this:

[project.optional-dependencies]
video = ["imageio-ffmpeg>=0.5.0"]

Then, update your package's code to gracefully handle cases where imageio-ffmpeg is not installed, perhaps by raising a more informative error message suggesting the user install the 'video' extra.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 096eefd and 3fe6ea6.

📒 Files selected for processing (1)
  • pyproject.toml (1 hunks)
🔇 Additional comments (1)
pyproject.toml (1)

31-31: Verify the impact of removing the "av" dependency

The removal of the "av" dependency aligns with the PR objective to drop it as a hard dependency due to bugs and compatibility issues. The retention of imageio-ffmpeg>=0.5.0 suggests that it might be used as an alternative for video processing tasks.

To ensure a smooth transition, please consider the following:

  1. Confirm that imageio-ffmpeg provides all the necessary functionality previously handled by "av".
  2. Update any code that previously used "av" to now use imageio-ffmpeg or other alternatives.
  3. Review and update documentation, README files, or inline comments that might reference "av".
  4. Consider adding a note in the project's changelog or release notes about this dependency change.

To help verify the impact of this change, you can run the following script:

This script will help identify any remaining references to "av" in the codebase that might need to be updated or removed.

@talmo talmo changed the title Drop av as a hard dependency Dependency management Sep 28, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
tests/io/test_video_backends.py (1)

78-97: LGTM with minor suggestions: pyav backend test is well-implemented.

The new test case for the pyav backend is well-structured and comprehensive. The try-except block is a good approach to handle the optional dependency. However, there are a couple of minor improvements we can make:

  1. The av import is flagged as unused, but it's indirectly used to check if the library is available. To make this more explicit and avoid the linter warning, you could use importlib.util.find_spec:
import importlib.util

if importlib.util.find_spec("av") is not None:
    # Rest of the test code
  1. Replace type(backend) == MediaVideo with isinstance(backend, MediaVideo) for a more idiomatic type check.

Would you like me to implement these changes?

🧰 Tools
🪛 Ruff

80-80: av imported but unused; consider using importlib.util.find_spec to test for availability

(F401)


85-85: Use is and is not for type comparisons, or isinstance() for isinstance checks

(E721)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3fe6ea6 and b482d4e.

📒 Files selected for processing (3)
  • environment.yml (1 hunks)
  • pyproject.toml (1 hunks)
  • tests/io/test_video_backends.py (2 hunks)
🧰 Additional context used
🪛 Ruff
tests/io/test_video_backends.py

80-80: av imported but unused; consider using importlib.util.find_spec to test for availability

(F401)


85-85: Use is and is not for type comparisons, or isinstance() for isinstance checks

(E721)

🔇 Additional comments (9)
environment.yml (3)

Line range hint 1-30: LGTM: Removal of av dependency

The av dependency has been successfully removed from the environment file, which aligns with the PR objective to address ongoing bugs and limited platform compatibility issues.


19-19: LGTM: Version constraint update for ndx-pose

The version constraint for ndx-pose has been correctly updated to ndx-pose<0.2.0, which aligns with the PR objective to pin it to a version lower than 0.2.0 until another pull request (#104) is merged.


Line range hint 1-30: Verify removal of livecov development tool

The PR objectives mention the removal of the livecov development tool, which is not visible in this environment.yml file. Could you please confirm if this change has been implemented in another file or if it needs to be addressed?

To help verify this, you can run the following script:

This script will help identify any remaining references to livecov in the project, allowing us to ensure its complete removal as per the PR objectives.

✅ Verification successful

To address the issues encountered with the previous script, please run the following updated script to search for any references to livecov in the project files:


To thoroughly verify the removal of the livecov development tool, please run the following comprehensive search script:


Verification Successful: livecov Removal Confirmed

The search across all project files did not find any references to livecov, confirming its removal as per the PR objectives.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any references to livecov in the project files

# Search for livecov in Python files
echo "Searching for livecov in Python files:"
rg --type python 'livecov'

# Search for livecov in other configuration files
echo "Searching for livecov in configuration files:"
rg --type yaml --type toml --type json 'livecov'

# Search for livecov in requirements files
echo "Searching for livecov in requirements files:"
rg 'livecov' *requirements*.txt

Length of output: 486


Script:

#!/bin/bash
# Description: Search for any references to livecov in the project files

# Search for livecov in Python files using correct type specifier
echo "Searching for livecov in Python files:"
rg -t py 'livecov'

# Search for livecov in YAML, TOML, and JSON configuration files
echo "Searching for livecov in YAML, TOML, and JSON configuration files:"
rg -t yaml -t toml -t json 'livecov'

# Search for livecov in requirements files with flexible pattern
echo "Searching for livecov in requirements files:"
rg 'livecov' --glob '*requirements*.yml' --glob '*requirements*.yaml' --glob '*requirements*.txt'

Length of output: 631


Script:

#!/bin/bash
# Description: Comprehensive search for any references to livecov in the project files

# Search for livecov in all files
echo "Searching for 'livecov' in all files:"
rg 'livecov'

# Additionally, search for any mentions in markdown or documentation files
echo "Searching for 'livecov' in documentation files:"
rg -g '*.md' -g '*.rst' 'livecov'

# Confirm if any requirements files exist before searching
echo "Checking for existence of requirements files..."
if ls *requirements*.txt 1> /dev/null 2>&1; then
  echo "Searching for 'livecov' in requirements files:"
  rg 'livecov' *requirements*.txt
else
  echo "No requirements.txt files found to search."
fi

Length of output: 474

pyproject.toml (3)

31-31: Please clarify the removal of coverage and pytest configurations.

The removal of sections related to coverage and pytest configuration aligns with the PR objective of removing the livecov development tool. However, it's important to ensure that this doesn't negatively impact the project's testing and coverage capabilities.

Could you please clarify:

  1. Have these configurations been moved to a different file?
  2. If not, are they no longer needed for the project?

To ensure that testing and coverage capabilities are maintained, please run:

#!/bin/bash
# Description: Check for coverage and pytest configurations in other files

# Test: Search for coverage configurations
rg '\[coverage:' 

# Test: Search for pytest configurations
rg '\[tool.pytest' 

# Test: Check if pytest and coverage are still mentioned in dev dependencies
rg 'pytest|coverage' pyproject.toml

If these configurations are still needed but have been moved, please update the PR description to reflect this change.


31-31: LGTM: Removal of av dependency.

The removal of the av dependency aligns with the PR objectives to improve stability and platform compatibility. The retention of imageio-ffmpeg suggests that video processing capabilities are maintained.

To ensure that all functionality previously dependent on av has been properly addressed, please run:

If any results are found, please ensure that these occurrences have been properly addressed or updated.


27-27: LGTM: Version constraint added for ndx-pose.

The addition of the version constraint "ndx-pose<0.2.0" aligns with the PR objectives and helps maintain stability until PR #104 is merged.

To ensure this constraint doesn't conflict with other dependencies, please run:

✅ Verification successful

Verified: ndx-pose version constraint is appropriate and no conflicts found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential conflicts with the ndx-pose version constraint

# Test: Search for ndx-pose usage in Python files
rg --type python 'ndx-pose'

# Test: Check if any other dependency specifications mention ndx-pose
rg 'ndx-pose' pyproject.toml setup.py setup.cfg requirements*.txt

Length of output: 320


Script:

#!/bin/bash
# Description: Check for potential conflicts with the ndx-pose version constraint

# Test: Search for ndx-pose usage in Python files with correct type specifier
rg --type py 'ndx-pose'

# Test: Check if any other dependency specifications mention ndx-pose, ignoring missing files
rg 'ndx-pose' pyproject.toml setup.py setup.cfg requirements*.txt || true

Length of output: 486

tests/io/test_video_backends.py (3)

Line range hint 62-77: LGTM: New FFMPEG backend test looks good.

The new test case for the FFMPEG backend is well-structured and comprehensive. It covers important aspects such as shape, slicing, and the keep_open behavior. The assertions are thorough and align with the existing test patterns.


Line range hint 99-114: LGTM: opencv backend test remains consistent.

The opencv backend test has been retained with minor adjustments to maintain consistency with the newly added tests for FFMPEG and pyav backends. The structure and assertions remain appropriate and comprehensive.

🧰 Tools
🪛 Ruff

80-80: av imported but unused; consider using importlib.util.find_spec to test for availability

(F401)


85-85: Use is and is not for type comparisons, or isinstance() for isinstance checks

(E721)


Line range hint 62-114: Overall: Excellent improvements to video backend testing.

The changes in this file significantly enhance the test coverage for various video backends, aligning well with the PR objectives of improving dependency management. The addition of FFMPEG and pyav backend tests, along with the retained opencv test, provides a more comprehensive suite for ensuring the correct behavior of different video backend options.

The use of a try-except block for the pyav test is a smart approach to handle the optional dependency, allowing the tests to run smoothly regardless of whether av is installed or not. This change supports the PR's goal of removing av as a hard dependency while still maintaining test coverage when it's available.

These improvements will contribute to better stability and compatibility of the project across different systems and configurations.

🧰 Tools
🪛 Ruff

80-80: av imported but unused; consider using importlib.util.find_spec to test for availability

(F401)


85-85: Use is and is not for type comparisons, or isinstance() for isinstance checks

(E721)

Copy link

codecov bot commented Sep 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.05%. Comparing base (096eefd) to head (5af40ba).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #118      +/-   ##
==========================================
+ Coverage   96.01%   96.05%   +0.03%     
==========================================
  Files          17       15       -2     
  Lines        2035     2000      -35     
==========================================
- Hits         1954     1921      -33     
+ Misses         81       79       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@talmo talmo merged commit 7e91d04 into main Sep 28, 2024
9 checks passed
@talmo talmo deleted the talmo/drop-av branch September 28, 2024 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant